__author__ = 'thanatos'

from config.config_develop import config as develop_config
from config.config_deploy import config as deploy_config

def merge(develop, deploy):
    result = {}
    for k, v in develop.items():
        if k in deploy.keys():
            if isinstance(v, dict):
                result[k] = merge(v, deploy[k])
            else:
                result[k] = deploy[k]
        else:
            result[k] = v
    return result

def to_dict(_d):
    d = getattr(__import__('base', globals(), locals()), 'Dict')()
    for k, v in _d.items():
        d[k] = to_dict(v) if isinstance(v, dict) else v
    return d

config = merge(develop_config, deploy_config)
config = to_dict(config)
